<html>
<head><meta charset="utf-8"><title>rust_2018_macro · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rust_2018_macro.html">rust_2018_macro</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="134831930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rust_2018_macro/near/134831930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rust_2018_macro.html#134831930">(Sep 28 2018 at 15:20)</a>:</h4>
<p>how can I import macros from extern crate?</p>
<div class="codehilite"><pre><span></span><span class="cp">#![deny(rust_2018_idioms)]</span><span class="w"></span>

<span class="c1">// compiles</span>
<span class="c1">// #[macro_use]</span>
<span class="c1">// extern crate clap; // 2.32.0</span>

<span class="k">use</span><span class="w"> </span><span class="n">clap</span>::<span class="n">app_from_crate</span><span class="p">;</span><span class="w"> </span><span class="c1">// err</span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="n">app_from_crate</span><span class="o">!</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p><a href="https://play.rust-lang.org/?gist=076c1b34c67f6afb38eeefb32421b557&amp;version=nightly&amp;mode=debug&amp;edition=2018" target="_blank" title="https://play.rust-lang.org/?gist=076c1b34c67f6afb38eeefb32421b557&amp;version=nightly&amp;mode=debug&amp;edition=2018">https://play.rust-lang.org/?gist=076c1b34c67f6afb38eeefb32421b557&amp;version=nightly&amp;mode=debug&amp;edition=2018</a></p>



<a name="134832082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rust_2018_macro/near/134832082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rust_2018_macro.html#134832082">(Sep 28 2018 at 15:22)</a>:</h4>
<p>and it's a bit strange that rustc won't errs even the deny enabled when comment <code>use ...</code> and uncomment <code>#[macro_use] extern ...</code></p>



<a name="134832249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rust_2018_macro/near/134832249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gabriel Majeri <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rust_2018_macro.html#134832249">(Sep 28 2018 at 15:25)</a>:</h4>
<p><code>use clap::*;</code> does seem to work<br>
I think the issue is with macro hygiene</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>